<?php

namespace LDL\Twspider\E;

use LDL\Twspider\E\TwspiderFactory;

class TwDefFactory implements TwspiderFactory
{
    protected $vendorPath;

    /*
     * @param $vpath vendor所在的目录  用于修复BUG
    * */
    function __construct($vpath = null)
    {
        if ($vpath == null) {
            throw new Exception("no defined vendor path ,it must fix __autoload in threads");
        }
        $this->vendorPath = $vpath . "/vendor";
    }

    //修复 加载的文件  以下目录下的TETS文件要删除不然 加载会出错
    function loadedFiles()
    {
        $rs = [$this->vendorPath . "/guzzlehttp/guzzle/src"
            , $this->vendorPath . "/guzzlehttp/psr7/src"
            , $this->vendorPath . "/guzzlehttp/promises/src"

            , $this->vendorPath . "/symfony/finder"
            , $this->vendorPath . "/symfony/dom-crawler"
            , $this->vendorPath . "/symfony/event-dispatcher"

            , $rs[] = $this->vendorPath . '/vdb/uri/src'
            , $rs[] = $this->vendorPath . '/jeremeamia/SuperClosure/src'

        ];
        return $rs;
    }
}
